<template>
  <el-card
    class="myQualifications-container"
    v-loading="loading"
    :element-loading-text="loadinText"
  >
    <el-table
      height="706"
      :data="myQualificationsList"
      type="border-card"
      style="width: 100%"
    >
      <el-table-column prop="cname" label="公司名称"> </el-table-column>
      <el-table-column prop="lperson" label="公司法人"> </el-table-column>
      <el-table-column fixed="right" label="操作" width="200">
        <template slot-scope="scope">
          <el-button
            @click="$router.push(`/enterprise/detail/${scope.row.cname}`)"
            type="text"
            size="small"
            >查看详情</el-button
          >
        </template>
      </el-table-column>
      <template slot="empty">
        <el-empty description="暂无我的资质"></el-empty>
      </template>
    </el-table>
    <!-- 分页组件 -->
    <div style="height: 60px; margin-top: 19px">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page"
        :page-sizes="[15, 30, 40]"
        :page-size="page_size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div>
  </el-card>
</template>

<script>
import { getMyQualificationsListApi } from '@/api/qualifications'
export default {
  name: 'myQualifications-page',
  created () {
    this.getMyQualificationsList()
  },
  data () {
    return {
      roleid: 0,
      loading: false,
      loadinText: '',
      page: 1,
      page_size: 15,
      total: 0,
      myQualificationsList: []
    }
  },
  methods: {
    // 获取我是资质客户
    async getMyQualificationsList () {
      const { data: res } = await getMyQualificationsListApi(
        this.page,
        this.page_size
      )
      // console.log('获取我是资质客户', res)
      this.myQualificationsList = res.data.lists
      this.total = res.data.customer_num
    },
    // 切换第几页
    handleCurrentChange (val) {
      this.page = val
      this.getMyQualificationsList()
    },
    // 手动更改页码
    handleSizeChange (val) {
      this.page_size = val
      this.getMyQualificationsList()
    }
  },
  watch: {}
}
</script>

<style lang="scss" scoped>
.myQualifications-container {
  box-sizing: border-box;
  height: 837px;
  padding: 25px 40px 0px;
}
</style>
